package faa;

import java.util.*;
import faa.objects.*;
import agent.*;

public class KnowledgeBase extends Agent{
	
		private LinkedList<Risk> risks = new LinkedList<Risk>();
		private LinkedList<Data> realWorldData = new LinkedList<Data>();
		private RiskManager riskManager;
		
		// Constructor 
		
		KnowledgeBase() {
			
		}
		
		// Accessors and Mutators
		
		public void setRisks(LinkedList<Risk> risks) {
			this.risks = risks;
		}
		
		public LinkedList<Risk> getRisks() {
			return risks;
		}
		
		public void setData(LinkedList<Data> realWorldData) {
			this.realWorldData = realWorldData;
		}
		
		public LinkedList<Data> getData() {
			return realWorldData;
		}
		
		public void setRiskManager(RiskManager riskManager) {
			this.riskManager = riskManager;
		}
		
		public RiskManager getRiskManager() {
			return riskManager;
		}
		
		// Messages
		
		public void msgHeresData(LinkedList<Data> newData) {
			for (int i = 0; i <= newData.size(); i++) {
				realWorldData.add(newData.get(i));
			}
		}
		
		// Scheduler
		
		public boolean pickAndExecuteAnAction() {
			if(!realWorldData.isEmpty()) {
				sendRisks();
				realWorldData.clear();
			}
			return false;
		}
		
		// Actions
		
		public void sendRisks() {
			riskManager.msgRisks(risks);
		}
	
}